<template>
	<uni-popup ref="faultreePopup" style="width: 500rpx;" type="center" :animation="false">
		<view class="faultpopup">
			<view class="mypopup__head">
				<slot name="head"></slot>
			</view>
			<view class="mypopup__body">
				<scroll-view :scroll-y="true">
					<view style="height:450rpx">
						 <slot name="body"></slot>
						<!-- <uni-list>
							<uni-list-item v-for="(faultItem,index) in faultList" :title="faultItem.Name" 
							 :key="index" :show-arrow="faultItem.level<5" @click.stop="clickFaultItem(index,$event)">
							</uni-list-item>
						</uni-list> -->
					</view>
				</scroll-view>
				<view class="mypopup__footer">
					<button class="cu-btn lg primary" @click="confirm">确定</button>
					<button class="cu-btn lg primary plain" @click="cancel">取消</button>
				</view>
			</view>
		</view>
	</uni-popup>
</template>

<script>
	import uniPopup from '@dcloudio/uni-ui/lib/uni-popup/uni-popup'
	// import uniList from "@dcloudio/uni-ui/lib/uni-list/uni-list.vue"
	// import uniListItem from "@dcloudio/uni-ui/lib/uni-list-item/uni-list-item.vue"
	export default {
		props: {
			faultList: {
				type: Array,
				default () {
					return []
				}
			},
		},
		components: {
			uniPopup,
			// uniList,
			// uniListItem
		},
		methods: {
			clickFaultItem(index, e) {
				this.$emit("clickFaultItem", this.faultList[index]);
			},
			cancel(e) {
				
				this.$emit("faultreeCancel", e);
				this.closePoPup();
			},
			confirm(e){
				this.$emit("confirmFaultItem", e);
				
				this.$emit("faultreeConfirm", e);
				this.closePoPup();
			},
			openPoPup() {
				this.$refs.faultreePopup.open();
			},
			closePoPup() {
				this.$refs.faultreePopup.close();
			},
		}
	}
</script>

<style>
	.faultpopup {
		width: 650rpx;
		background-color: #ffffff;
		box-shadow: 0px 0px 8rpx 0px rgba(0, 0, 0, 0.2);
		border-radius: 8rpx;
		padding: 20rpx;
	}
</style>
